package ThaumPerditio.common.registry;

import java.util.ArrayList;
import java.util.HashMap;

import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.RecipesWeapons;
import net.minecraft.nbt.NBTTagByte;
import net.minecraft.util.ResourceLocation;
import ThaumPerditio.common.ThaumPerditio;
import ThaumPerditio.common.research.ThaumPerditioResearchItem;
import ThaumPerditio.common.research.ThaumcraftResearchItem;
import ThaumPerditio.common.lib.LibReference;
import thaumcraft.api.ItemApi;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.crafting.CrucibleRecipe;
import thaumcraft.api.crafting.IArcaneRecipe;
import thaumcraft.api.crafting.InfusionEnchantmentRecipe;
import thaumcraft.api.crafting.InfusionRecipe;
import thaumcraft.api.research.ResearchPage.PageType;
import thaumcraft.api.research.*;
import thaumcraft.client.lib.UtilsFX;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.config.ConfigItems;

public class ResearchRegistry {
    public static final String TP = "ThaumPerditio";
    public static HashMap recipes = new HashMap();

    public static ItemStack getOriginalItem(String name, String category) {
        return ((ResearchCategoryList) ResearchCategories.researchCategories.get(category)).research.get(name).icon_item;
    }



    public static void initResearch() {
        ResearchCategories.registerCategory(TP, new ResourceLocation("ThaumPerditio:textures/misc/IconPerditio.png"), new ResourceLocation("thaumcraft:textures/gui/gui_researchback.png"));

        /**
         * Thaumcraft research items
         */

        //Ifusion Enchant
        new ThaumcraftResearchItem("TPINFUSION", TP, "INFUSION", "ARTIFICE", 2, 0, new ItemStack(LibReference.stoneDevice,1,2)).setSpecial().setConcealed().setRound().setStub().registerResearchItem();

        //Adding wands

        new ThaumcraftResearchItem("TPGREATWCORE", TP, "ROD_greatwood", "THAUMATURGY", 1, -7, new ItemStack(LibReference.wcore)).setSpecial().setConcealed().setRound().setStub().registerResearchItem();
        new ThaumcraftResearchItem("TPOBSIDIANWCORE", TP, "ROD_obsidian", "THAUMATURGY", -5, -3, new ItemStack(LibReference.wcore,1,1)).setSpecial().setConcealed().setRound().setStub().registerResearchItem();
        new ThaumcraftResearchItem("TPSILVERWCORE", TP, "ROD_silverwood", "THAUMATURGY", -1, -7, new ItemStack(LibReference.wcore,1,2)).setSpecial().setConcealed().setRound().setStub().registerResearchItem();
        new ThaumcraftResearchItem("TPICEWCORE", TP, "ROD_ice", "THAUMATURGY", 5, -3, new ItemStack(LibReference.wcore,1,3)).setSpecial().setConcealed().setRound().setStub().registerResearchItem();
        new ThaumcraftResearchItem("TPQUARTZWCORE", TP, "ROD_quartz", "THAUMATURGY", 4, -6, new ItemStack(LibReference.wcore,1,4)).setSpecial().setConcealed().setRound().setStub().registerResearchItem();
        new ThaumcraftResearchItem("TPREEDWCORE", TP, "ROD_reed", "THAUMATURGY", 5, -2, new ItemStack(LibReference.wcore,1,5)).setSpecial().setConcealed().setRound().setStub().registerResearchItem();
        new ThaumcraftResearchItem("TPBLAZEWCORE", TP, "ROD_blaze", "THAUMATURGY", -4, -6, new ItemStack(LibReference.wcore,1,6)).setSpecial().setConcealed().setRound().setStub().registerResearchItem();
        new ThaumcraftResearchItem("TPBONEWCORE", TP, "ROD_bone", "THAUMATURGY", -5, -2, new ItemStack(LibReference.wcore,1,7)).setSpecial().setConcealed().setRound().setStub().registerResearchItem();


        /**
         * Thaum Perditio research items
         */

        new ThaumPerditioResearchItem("TPINFO", TP, new AspectList(),0, 0, 0, new ResourceLocation("ThaumPerditio:textures/misc/IconPerditio.png")).setConcealed().setAutoUnlock().setPages(new ResearchPage[]{
                new ResearchPage("1")}).registerResearchItem();

        new ThaumPerditioResearchItem("TPBASE", TP, new AspectList(),0, -2, 0, new ItemStack(LibReference.defusionDevice,1,0) ).setConcealed().setParents(new String[]{
                "TPINFO",
                "TPINFUSION"}).setPages(new ResearchPage[]{
                new ResearchPage("1")}).registerResearchItem();

        //Wand Disassemble
        new ThaumPerditioResearchItem("TPGREATWDIS", TP, new AspectList(),1, -5, 0, new ItemStack(LibReference.wcore)).setConcealed().setSecondary().setRound().setParents(new String[]{
                "TPBASE",
                "TPGREATWCORE"}).setPages(new ResearchPage[]{
                new ResearchPage("1")}).registerResearchItem();
        new ThaumPerditioResearchItem("TPOBSIDIANWDIS", TP, new AspectList(),-3, -3, 0, new ItemStack(LibReference.wcore,1,1)).setConcealed().setSecondary().setRound().setParents(new String[]{
                "TPBASE",
                "TPOBSIDIANWCORE"}).setPages(new ResearchPage[]{
                new ResearchPage("1")}).registerResearchItem();
        new ThaumPerditioResearchItem("TPSILVERWDIS", TP, new AspectList(),-1, -5, 0, new ItemStack(LibReference.wcore,1,2)).setConcealed().setSecondary().setRound().setParents(new String[]{
                "TPBASE",
                "TPSILVERWCORE"}).setPages(new ResearchPage[]{
                new ResearchPage("1")}).registerResearchItem();
        new ThaumPerditioResearchItem("TPICEWDIS", TP, new AspectList(),3, -3, 0, new ItemStack(LibReference.wcore,1,3)).setConcealed().setSecondary().setRound().setParents(new String[]{
                "TPBASE",
                "TPICEWCORE"}).setPages(new ResearchPage[]{
                new ResearchPage("1")}).registerResearchItem();
        new ThaumPerditioResearchItem("TPQUARTZWDIS", TP, new AspectList(),2, -4, 0, new ItemStack(LibReference.wcore,1,4)).setConcealed().setSecondary().setRound().setParents(new String[]{
                "TPBASE",
                "TPQUARTZWCORE"}).setPages(new ResearchPage[]{
                new ResearchPage("1")}).registerResearchItem();
        new ThaumPerditioResearchItem("TPREEDWDIS", TP, new AspectList(),3, -2, 0, new ItemStack(LibReference.wcore,1,5)).setConcealed().setSecondary().setRound().setParents(new String[]{
                "TPBASE",
                "TPREEDWCORE"}).setPages(new ResearchPage[]{
                new ResearchPage("1")}).registerResearchItem();
        new ThaumPerditioResearchItem("TPBLAZEWDIS", TP, new AspectList(),-2, -4, 0, new ItemStack(LibReference.wcore,1,6)).setConcealed().setSecondary().setRound().setParents(new String[]{
                "TPBASE",
                "TPBLAZEWCORE"}).setPages(new ResearchPage[]{
                new ResearchPage("1")}).registerResearchItem();
        new ThaumPerditioResearchItem("TPBONEWDIS", TP, new AspectList(),-3, -2, 0, new ItemStack(LibReference.wcore,1,7)).setConcealed().setSecondary().setRound().setParents(new String[]{
                "TPBASE",
                "TPBONEWCORE"}).setPages(new ResearchPage[]{
                new ResearchPage("1")}).registerResearchItem();

    }
}
